import { Navigate } from 'react-router-dom'
import Login from '../pages/Login'
import LayoutContainer from '../components/Layout'
import Home from '../pages/Home'
import UserManage from '../pages/UserManage'
import UserList from '../pages/UserManage/UserList'
import RightManage from '../pages/RightManage'
import RightList from '../pages/RightManage/RightList'
import RoleManage from '../pages/RightManage/RoleList'
import NoPermission from '../pages/NoPermission'
//新闻管理
import NewsManage from '../pages/NewsManage'
import Add from '../pages/NewsManage/Add'
import Draft from '../pages/NewsManage/Draft'
import Category from '../pages/NewsManage/Category'

import Preview from '../pages/NewsManage/Preview'
import Update from '../pages/NewsManage/Update'
//审核管理
import AuditManage from '../pages/AuditManage'
import AuditList from '../pages/AuditManage/AuditList'
import AuditNews from '../pages/AuditManage/AuditNews'

// 发布管理
import PublishManage from '../pages/PublishManage'
import Published from '../pages/PublishManage/Published'
import Unpublished from '../pages/PublishManage/Unpublished'
import Sunset from '../pages/PublishManage/Sunset'


// 1、任何角色都能看到的静态路由
export const constantRoutes = [
  {
    path: '/login',
    element:<Login/>
  },
  {
    path: '/',
    element:<Navigate to='/login'/>,
  }
]

export const asyncRoutes = [
  {
    path: '/',
    element: <LayoutContainer />,
    children: [
      {
        path: 'home',
        element: <Home />,
      },
      {
        path: 'user-manage',
        element: <UserManage />,
        children: [
          {
            path: 'list',
            element: <UserList />,
          }
        ]
      },
      {
        path: 'right-manage',
        element: <RightManage />,
        children: [
          {
            path: 'right/list',
            element: <RightList />,
          },
          {
            path: 'role/list',
            element: <RoleManage/>,
          },
          
        ]
      },
       //新闻管理
       {
        path: 'news-manage',
        element: <NewsManage />,
        children: [
          {
            path: 'add',
            element: <Add/>,
          },
          {
            path: 'draft',
            element: <Draft/>,
          },
          {
            path: 'category',
            element: <Category/>,
          },
          //新闻预览
          {
            path:'preview/:id',
            element:<Preview/>
          },
          //新闻更新
          {
            path:'update/:id',
            element:<Update/>
          },
          
        ]
      },
      //审核管理
      {
        path: 'audit-manage',
        element: <AuditManage />,
        children: [
          //审核新闻
          {
            path: 'audit',
            element: <AuditNews />,
          },
          // 审核列表
          {
            path: 'list',
            element: <AuditList/>,
          },
        ]
      },
      //发布管理
      {
        path: 'publish-manage',
        element: <PublishManage />,
        children: [
          //未发布
          {
            path: 'unpublished',
            element: <Unpublished/>,
          },
          //已发布
          {
            path: 'published',
            element: <Published/>,
          },
          //已下线
          {
            path: 'sunset',
            element: <Sunset/>,
          },
        ]
      },
      {
        path: '*',
        element:<NoPermission/>,
      },
      {
        path: '/',
        element:<Navigate to='/home'/>,
      }
    ]
  }
]